package com.vessel.decoration.mvp.ui.activity.me;

import android.os.Bundle;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.jess.arms.di.component.AppComponent;
import com.vessel.decoration.R;
import com.vessel.decoration.app.base.MySupportActivity;
import com.vessel.decoration.mvp.ui.fragment.mine.MeAboutFragment;
import com.vessel.decoration.mvp.ui.fragment.mine.MeAddressFragment;
import com.vessel.decoration.mvp.ui.fragment.mine.MeBusinessFragment;
import com.vessel.decoration.mvp.ui.fragment.mine.MeCollectFragment;
import com.vessel.decoration.mvp.ui.fragment.mine.MeNotePadFragment;
import com.vessel.decoration.mvp.ui.fragment.mine.MeOrderFragment;
import com.vessel.decoration.mvp.ui.fragment.mine.MeSuggestFragment;
import com.vessel.decoration.mvp.ui.fragment.mine.MeSettingFragment;
import com.vessel.decoration.mvp.ui.fragment.mine.MeWorkerFragment;

import me.yokeyword.fragmentation.ISupportFragment;

import static com.vessel.decoration.app.constant.Constants.PAGE;
import static com.vessel.decoration.app.constant.Constants.PAGE_ABOUT;
import static com.vessel.decoration.app.constant.Constants.PAGE_ADDRESS;
import static com.vessel.decoration.app.constant.Constants.PAGE_BUSINESS;
import static com.vessel.decoration.app.constant.Constants.PAGE_COLLECT;
import static com.vessel.decoration.app.constant.Constants.PAGE_NOTEBOOK;
import static com.vessel.decoration.app.constant.Constants.PAGE_ORDER;
import static com.vessel.decoration.app.constant.Constants.PAGE_SUGGEST;
import static com.vessel.decoration.app.constant.Constants.PAGE_USERINFO;
import static com.vessel.decoration.app.constant.Constants.PAGE_WORKER;

/**
 * @author vesselzhang
 * @date 2017/11/28
 */
@Route(path = "/app/me")
public class MeActivity extends MySupportActivity {

    @Override
    public void setupActivityComponent(AppComponent appComponent) {

    }

    @Override
    public int initView(Bundle savedInstanceState) {
        return R.layout.include_main_content;
    }

    @Override
    public void initData(Bundle savedInstanceState) {
        ISupportFragment targetFragment = null;
        int pageIndex = getIntent().getIntExtra(PAGE, PAGE_COLLECT);
        switch (pageIndex) {
            case PAGE_USERINFO:
                targetFragment = MeSettingFragment.newInstance();
                break;
            case PAGE_ORDER:
                targetFragment = MeOrderFragment.newInstance();
                break;
            case PAGE_COLLECT:
                targetFragment = MeCollectFragment.newInstance();
                break;
            case PAGE_ADDRESS:
                targetFragment = MeAddressFragment.newInstance();
                break;
            case PAGE_NOTEBOOK:
                targetFragment = MeNotePadFragment.newInstance();
                break;
            case PAGE_BUSINESS:
                targetFragment = MeBusinessFragment.newInstance();
                break;
            case PAGE_WORKER:
                targetFragment = MeWorkerFragment.newInstance();
                break;
            case PAGE_SUGGEST:
                targetFragment = MeSuggestFragment.newInstance();
                break;
            case PAGE_ABOUT:
                targetFragment = MeAboutFragment.newInstance();
                break;
        }
        loadRootFragment(R.id.fl_content, targetFragment);
    }
}
